package de.bazinga.rotw.base.attacker;

import com.captiveimagination.jgn.message.Message;
import com.captiveimagination.jgn.message.type.CertifiedMessage;
import com.captiveimagination.jgn.message.type.PlayerMessage;
import com.captiveimagination.jgn.message.type.TimestampedMessage;

import de.bazinga.rotw.game.RotwGameState;
import de.bazinga.rotw.network.message.GameMessage;

public class AttackerUpdateMessage extends Message implements CertifiedMessage, PlayerMessage, TimestampedMessage, GameMessage {	
	private boolean requestUpdate = true;
	
	
	public void handleMessage(RotwGameState game, Message msg, boolean server) {
		if(!(msg instanceof AttackerUpdateMessage)) return ;

		// Player touched a item
		AttackerUpdateMessage message = (AttackerUpdateMessage)msg;
		
		if(server) {
			if(message.isRequestUpdate()) {
				
				/*if(AttackerList.getAttackers() != null && AttackerList.getAttackers().size() != 0) {
					for(BaseAttacker att:AttackerList.getAttackers()) {
						AttackerCreateMessage attMsg = new AttackerCreateMessage();
						attMsg.setAttackerId(att.getAttackerId());
						attMsg.setLocation(att.getLocalTranslation());

						((Server)game.getSyncManager()).getServer().sendToPlayer(attMsg, getPlayerId());
					}
				}*/
			}
		}else{
			
		}
	}

	public void setRequestUpdate(boolean requestUpdate) {
		this.requestUpdate = requestUpdate;
	}

	public boolean isRequestUpdate() {
		return requestUpdate;
	}
}